let historyComponent = {
    template: `
        <div class="history page">
            <div class="head">
                 <div class="left" @click="back">
                    <span class="iconfont icon-ali-fanhui"></span>
                </div>
                <div class="title">{{title}}</div>
                <div class="right"></div>
            </div>
            <div class="main">
               <div class="content">
                   <div class="item" v-for="item in categoryList" @click="handleView(item)">
                        <div class="item-name">{{item.name}}</div>
                        <div class="publisher">{{item.description}}</div>
                        <div class="state">
                            {{item.state===0?'draft':''}}
                            {{item.state===1?'release':''}}
                            {{item.state===2?'formal':''}}
                        </div>
                    </div>
               </div>
            </div>
        </div>
    `,
    data() {
        return {
            categoryList:[],
            filter:{
                name:null,
                description:null
            },
            title:null
        }

    },
    computed: {},
    watch: {},
    mounted() {
        this.title = this.$route.name
        this.fetchDataList()
    },
    activated() {

    },
    methods: {
        back(){
            this.$router.back()
        },
        fetchDataList(){
            let filter = {
                // state:{"op":"IN","value":[0,1,2]}
            }
            treatmentSession.getSelfList(JSON.stringify(filter)).then((entities)=>{

                entities.sort(function(a,b){return b.id-a.id})

                this.categoryList = entities
            })
        },
        handleView(item){
            window.sessionSelf = item
            this.$router.push({
                name:'session-instance',
                query:{
                    sessionId: item.id
                }
            })
        }
    },
    components: {},
    beforeRouteLeave(to, from, next) {

        next();
    }
}

